CFLAGS=-D_GNU_SOURCE -std=gnu17 -Wall -O0 -static -I./deps/include
LIBS=deps/lib/libnftnl.a deps/lib/libmnl.a

.PHONY: exploit
exploit:
	$(CC) $(CFLAGS) exploit.c -o exploit $(LIBS)

prerequisites:
	mkdir -p deps
	wget -O libmnl-1.0.5.tar.bz2 https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2
	tar -xf libmnl-1.0.5.tar.bz2
	cd libmnl-1.0.5 && ./configure --prefix=$(PWD)/deps --enable-static=yes --enable-shared=no && make install
	wget -O libnftnl-1.2.8.tar.xz https://www.netfilter.org/pub/libnftnl/libnftnl-1.2.8.tar.xz
	tar -xf libnftnl-1.2.8.tar.xz
	cd libnftnl-1.2.8 && LIBMNL_CFLAGS=-I$(PWD)/deps/include LIBMNL_LIBS=$(PWD)/deps/lib/libmnl.a ./configure --prefix=$(PWD)/deps --enable-static=yes --enable-shared=no && make install
	rm -rf libmnl* libnftnl*
